package com.coffee.mycoffee.controller;


import com.coffee.mycoffee.config.utils.Resp;
import com.coffee.mycoffee.pojo.User;
import com.coffee.mycoffee.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 咖啡
 * @since 2020-10-05
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("register")
    public Resp login(User user) {
        System.out.println("ok");

        
        Boolean flag = this.userService.register(user);
        if (flag) {
            return Resp.ok();
        }
        return Resp.error();
    }
}

